#include <dolphin/socket.h>
int SOGetSockOpt ( int s, int level, int optname,
void* optval, int* optlen );
SOGetSockOpt() gets the socket options. The supported options are
summarized in the following table:
| Level | Option name | Type | TCP | UDP | Description |
SO_SOL_SOCKET |
SO_SO_REUSEADDR |
BOOL |
• |
• | Allows reuse of the local address. |
SO_SOL_SOCKET |
SO_SO_OOBINLINE |
BOOL |
• | Receives urgent byte in band. | |
SO_SOL_SOCKET |
SO_SO_TYPE |
int |
• | • | SO_SOCK_DGRAM for UDP. for TCP. |
SO_SOL_SOCKET |
SO_SO_LINGER |
SOLinger |
• | Lingers on a close when data exist. | |
SO_SOL_SOCKET |
SO_SO_SNDBUF |
int |
• | • | The socket send buffer size in bytes. |
SO_SOL_SOCKET |
SO_SO_RCVBUF |
int |
• | • | The socket receive buffer size in bytes. |
SO_SOL_SOCKET |
SO_SO_SNDLOWAT |
int |
• | The send low water mark in bytes (default: 1). | |
SO_SOL_SOCKET |
SO_SO_RCVLOWAT |
int |
• | The receive low water mark in bytes (default: 1). | |
SO_SOL_IP |
SO_IP_TOS |
int |
• | • | Type of service. |
SO_SOL_IP |
SO_IP_TTL |
int |
• | • | Time To Live. |
SO_SOL_IP |
SO_IP_MULTICAST_LOOP |
u8 |
• | • | Loops back multicast datagrams (default: enabled). |
SO_SOL_IP |
SO_IP_MULTICAST_TTL |
u8 |
• | • | Time to live set to multicast datagrams (default: 1). |
SO_SOL_TCP |
SO_TCP_NODELAY |
BOOL |
• | Turn the Nagle's algorithm off. | |
SO_SOL_TCP |
SO_TCP_MAXSEG |
int |
• | The maximum segment size (MSS) for outgoing TCP packets. |
s |
The socket descriptor. |
level |
The protocol level (one of SO_SO_*). |
optname |
The option name to get (one of SO_* shown above). |
optval |
A pointer to the buffer where the option value is stored. |
optlen |
The option length in bytes. Before the call, *optlen
must be set to the size of the optval
buffer. On return, *optlen contains
the number of bytes actually stored in optval. |
| zero | Succeeded. |
SO_EBADF |
Bad socket descriptor. |
SO_EINVAL |
Invalid operation. |
SO_ENETRESET |
Socket library is not initialized. |
SO_ENOPROTOOPT |
Non-supported option. |
Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.